# 1.先形成.o
# 2.生成静态库
#
CC=gcc 
mylib=libcal.a
$(mylib):myadd.o mysub.o
	ar -rc $(mylib) $^
%.o:%.c
	$(CC) -c $<

.PHONY:clean
clean:
	rm -f $(mylib) *.o output 

# 发布
.PHONY:output
output:
	mkdir -p mylib/include
	mkdir -p mylib/lib 
	cp *.h mylib/include
	cp *.a mylib/lib 

# Makefile 命令2
#libmymath.a:myadd.o mysub.o # 
#	ar -rc $@ $^
#myadd.o:myadd.c
#	gcc -c $<
#
#mysub.o:mysub.c
#	gcc -c $<
#
#.PHONY:clean
#clean:
#	rm -rf ouput *.o libmymath.a   
#
#.PHONY:output
#output:
#	mkdir -p mylib/include
#	mkdir -p mylib/lib 
#	cp *.h mylib/include
#	cp *.a mylib/lib 
